package com.higold.cloud.ui.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.higold.cloud.R
import com.higold.cloud.view.recyclerview.adapter.MultipleItem
import net.lucode.hackware.magicindicator.MagicIndicator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView


/**
 *    author : lxz
 *    date   : 2019/6/26 10:39
 *    desc   :业务员首页Adapter
 */

class NewHomeAdapter(context: Context, data: List<MultipleItem>) : BaseMultiItemQuickAdapter<MultipleItem, BaseViewHolder>(data) {

    private var commonNavigator: CommonNavigator = CommonNavigator(context)

    init {
        addItemType(MultipleItem.REPORT_TITLE, R.layout.home_report_title)
    }

    override fun convert(helper: BaseViewHolder, item: MultipleItem) {
        when (helper.itemViewType) {
            MultipleItem.REPORT_TITLE ->
                setMagicIndicator(helper.getView(R.id.magic_indicator))
        }
    }

    private fun setMagicIndicator(magicIndicator: MagicIndicator) {
        commonNavigator.adapter = object : CommonNavigatorAdapter() {
            override fun getCount(): Int {
                return 0
            }

            override fun getTitleView(context: Context, index: Int): IPagerTitleView? {
                return null
            }

            override fun getIndicator(context: Context): IPagerIndicator? {
                return null
            }
        }
        magicIndicator.navigator = commonNavigator
    }

}

